/**
  ******************************************************************************
  * @file    Instrument.c
  * @author  Dajin Li
  * @version V0.0.1
  * @date    08-08-2015 
  * @brief   This file contains all the Instrument function
  *          
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; KION(SZ) R&D Center
  *
  * Licensed under KION, (the "License");
  *
  ******************************************************************************
  */
/* Includes ------------------------------------------------------------------*/

#include <stdio.h>
#include <string.h>
#include "instrument.h"
#include "lcd.h"
#include "var_tbl.h"

#define HIDE_ENABLE   1             //display the character
#define HIDE_DISABLE  0             //hide the character
typedef enum 
{
    SIZE_22,
    SIZE_12,
    SIZE_7,
}font_size;

typedef const unsigned char font_t; 


/*--  LindeDaxOffice18; font wide x height = 18x29   --*/
/*--  pixel wide x height = 18x32  --*/
font_t number_Size22[10][72] = 
{
    //0
    {
        0x00,0x00,0x00,0x03,0x07,0x07,0x0E,0x0C,0x0C,0x0C,0x0E,0x0F,0x07,0x03,0x01,0x00,
        0x00,0x00,0x00,0x3F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,
        0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFE,0xFF,0x0F,0x03,0x01,0x00,0x00,0x00,0x01,0x03,
        0x0F,0xFF,0xFC,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xC0,0xC0,
        0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
    },
    //1
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x80,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,
        0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,
    },
    //2
    {
        0x00,0x00,0x00,0x03,0x06,0x0E,0x0C,0x0C,0x0C,0x0C,0x0E,0x07,0x07,0x03,0x01,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x0F,0xFF,0xFE,
        0xF8,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3C,0x78,0xF0,0xE0,0xC0,0xC0,0x80,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
        0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,
    },
    //3
    {
        0x00,0x00,0x00,0x03,0x06,0x0C,0x0C,0x0C,0x0C,0x0E,0x0F,0x07,0x03,0x01,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x03,0x07,0x0F,0xFD,0xF8,0xF0,
        0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x80,0x81,0xC3,
        0xFF,0xFF,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
        0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
    },
    //4
    {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x0F,0x0F,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x3C,0xF8,0xE0,0x80,0xFF,0xFF,0xFF,
        0x00,0x00,0x00,0x00,0x00,0x18,0x78,0xF8,0xD8,0x98,0x18,0x18,0x18,0x18,0x18,0xFF,
        0xFF,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,
    },
    //5
    {
        0x00,0x00,0x00,0x00,0x0F,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0x06,0x06,0x06,0x07,0x07,0x03,0x03,0x01,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x83,
        0xFF,0xFF,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
        0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,
    },
    //6
    {
        0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x06,0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x06,0x00,
        0x00,0x00,0x00,0x00,0x0F,0x7F,0xFF,0xC3,0x86,0x0C,0x0C,0x0C,0x0C,0x0E,0x07,0x07,
        0x03,0x00,0x00,0x00,0x00,0x00,0xF0,0xFE,0xFF,0x07,0x01,0x00,0x00,0x00,0x00,0x01,
        0x03,0xFF,0xFE,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,
        0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,
    },
    //7
    {
        0x00,0x00,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0D,0x0F,0x0F,0x0C,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x3F,0x7C,0xF0,0xC0,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x1F,0x7F,0xFC,0xE0,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    },
    //8
    {
        0x00,0x00,0x01,0x03,0x07,0x07,0x0E,0x0C,0x0C,0x0C,0x0E,0x07,0x07,0x03,0x01,0x00,
        0x00,0x00,0x00,0x00,0xE0,0xF9,0xFF,0x1F,0x0E,0x06,0x06,0x06,0x0E,0x1F,0xFF,0xF9,
        0xE0,0x00,0x00,0x00,0x00,0x7C,0xFF,0xFF,0x83,0x01,0x00,0x00,0x00,0x00,0x00,0x01,
        0x83,0xFF,0xFF,0x7C,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,
        0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,
    },
    //9
    {
        0x00,0x00,0x00,0x01,0x03,0x07,0x0E,0x0C,0x0C,0x0C,0x0C,0x0E,0x07,0x03,0x01,0x00,
        0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0x03,0x01,0x00,0x00,0x00,0x00,0x01,0x83,0xFF,
        0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x80,0xC0,0xC0,0xC0,0xC1,0xC1,0x83,
        0x0F,0xFE,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
        0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
    },
};
/*--  LindeDaxOffice18; font wide x height = 18x29   --*/
/*--  pixel wide x height = 18x32  --*/
font_t number_Size12[10][26] = 
{
    //0
    {
    0x00,0x00,0x1F,0x3F,0x7F,0x70,0x40,0x60,0x7F,0x3F,0x1F,0x00,0x00,0x00,0x00,0xE0,
    0xF0,0xF8,0x18,0x08,0x18,0xF8,0xF0,0xE0,0x00,0x00,
    },
    //1
    {
        0x00,0x00,0x10,0x30,0x30,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0xF8,0xF8,0xF8,0x00,0x00,0x00,0x00,0x00,
    },
    //2
    {
        0x00,0x00,0x00,0x60,0x60,0x40,0x41,0x67,0x7F,0x3E,0x1C,0x00,0x00,0x00,0x00,0x18,
        0x78,0xF8,0xE8,0xC8,0x88,0x08,0x08,0x08,0x00,0x00,
    },
    //3
    {
        0x00,0x00,0x00,0x20,0x62,0x42,0x46,0x7F,0x7D,0x3D,0x00,0x00,0x00,0x00,0x00,0x10,
        0x18,0x18,0x08,0x08,0xB8,0xF8,0xF0,0xE0,0x00,0x00,
    },
    //4
    {
        0x00,0x00,0x00,0x03,0x07,0x1F,0x7C,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x40,0xC0,
        0xC0,0xC0,0x40,0x40,0xF8,0xF8,0xF8,0x40,0x40,0x00,
    },
    //5
    {
        0x00,0x00,0x7E,0x7E,0x7E,0x42,0x43,0x43,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x18,
        0x18,0x08,0x08,0xB8,0xF8,0xF0,0xE0,0x00,0x00,0x00,
    },
    //6
    {
        0x00,0x00,0x07,0x1F,0x3F,0x7B,0x62,0x43,0x43,0x43,0x01,0x00,0x00,0x00,0x00,0xC0,
        0xF0,0xF8,0x18,0x08,0x18,0xF8,0xF0,0xF0,0x00,0x00,
    },
    //7
    {
        0x00,0x00,0x40,0x40,0x40,0x41,0x4F,0x7F,0x7E,0x70,0x40,0x00,0x00,0x00,0x00,0x00,
        0x00,0x78,0xF8,0xF8,0xC0,0x00,0x00,0x00,0x00,0x00,
    },
    //8
    {
        0x00,0x00,0x18,0x3D,0x7F,0x7F,0x42,0x67,0x7F,0x3D,0x00,0x00,0x00,0x00,0x00,0xE0,
        0xF0,0xF8,0x18,0x08,0x18,0xF8,0xF0,0xF0,0x00,0x00,
    },
    //9
    {
        0x00,0x00,0x1C,0x3E,0x7F,0x63,0x41,0x63,0x7F,0x3F,0x1F,0x00,0x00,0x00,0x00,0x00,
        0x18,0x18,0x08,0x18,0x38,0xF0,0xF0,0xC0,0x00,0x00,
    },
};
/*--  LindeDaxOffice18; font wide x height = 7x8   --*/
/*--  pixel wide x height = 7 X 8  --*/
font_t number_Size7[10][7] = 
{

    {0x00,0x00,0x3C,0x42,0x3C,0x00,0x00,},//0
    {0x00,0x00,0x20,0x7E,0x00,0x00,0x00,},//1
    {0x00,0x00,0x26,0x4A,0x32,0x00,0x00,},//2
    {0x00,0x00,0x42,0x52,0x2C,0x00,0x00,},//3
    {0x00,0x00,0x0C,0x34,0x7E,0x04,0x00,},//4
    {0x00,0x00,0x72,0x52,0x4C,0x00,0x00,},//5
    {0x00,0x00,0x1C,0x32,0x4C,0x00,0x00,},//6
    {0x00,0x00,0x46,0x58,0x60,0x00,0x00,},//7
    {0x00,0x00,0x2C,0x52,0x2C,0x00,0x00,},//8
    {0x00,0x00,0x32,0x4C,0x38,0x00,0x00,},//9
};

/*--  LindeDaxOffice18; font wide x height = 13x29   --*/
/*--  pixel wide x height = 26x32  --*/
/*Sign encode table:*/
/*0 -----   "%"*/
/*1 -----   "/"*/
/*2 -----   ":"*/
/*3 -----   "!"*/
/*4 -----   "+"*/
/*5 -----   "-"*/
/*6 -----   ";"*/
/*7 -----   "."*/
/*8 -----   " "*/
/*9 -----   ""*/
/*10-----   ""*/

font_t sign_size22[10][104] =
{
    //%
    {
        0x00,0x01,0x07,0x06,0x0C,0x0C,0x0C,0x0C,0x0E,0x07,0x01,0x00,0x00,0x00,0x00,0x00,
        0x00,0x03,0x07,0x0C,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFC,0x0C,0x06,0x06,
        0x06,0x06,0x0C,0xFC,0xF0,0x01,0x03,0x0E,0x1C,0x70,0xE0,0x81,0x01,0x01,0x01,0x01,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x1C,0x38,0xE0,0xC0,
        0x00,0x00,0x3E,0x7F,0xE1,0x80,0x80,0x80,0x80,0x80,0xC1,0xFF,0x3E,0x00,0x00,0x00,
        0x00,0x00,0x40,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,
        0xC0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,
    },
};
font_t sign_size12[10][26] =
{
    //Percent----"%"
    {
        0x00,0x3F,0x40,0x40,0x3F,0x01,0x06,0x38,0x47,0x08,0x08,0x07,0x00,0x00,0x00,0x80,
        0x80,0x30,0xC0,0x00,0x00,0xE0,0x10,0x10,0xE0,0x00,
    },
    //Slash----"/"
    {
        0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x38,0x60,0x40,0x00,0x00,0x00,0x00,0x00,0x08,
        0x38,0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

    },
    //Colon----":"
    {
        0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
    },
};
/*--  LindeDaxOffice18; font wide x height = 9x8   --*/
/*--  pixel wide x height = 9x8  --*/
font_t sign_size7[10][9] = 
{
    //Percent----"%"
    {0x20,0x52,0x24,0x08,0x10,0x24,0x4A,0x04,0x00,},
    //Slash----"/"
    {0x00,0x00,0x02,0x04,0x18,0x20,0x40,0x00,0x00,},
    //Colon----":"
    {0x00,0x00,0x00,0x12,0x12,0x00,0x00,0x00,0x00,},
    //Exclamation point----"!"
    {0x00,0x00,0x00,0x00,0x7A,0x00,0x00,0x00,0x00,},
    //Increase----"+"
    {0x00,0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00,},
    //Decrease----"-"
    {0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,},
    //Semicolon----";"
    {0x00,0x00,0x02,0x14,0x14,0x00,0x00,0x00,0x00,},
    //Period----"."
    {0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,},
    //Space----" "
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,},
    //Star----"*"
    {0x00,0x92,0x54,0x38,0xFE,0x38,0x54,0x92,0x00,}
    
};
font_t char_h_lower_Size12[26] = 
{
    //"h"----Size 12 for the hour counter sign
    0x00,0x00,0x7F,0x7F,0x02,0x04,0x04,0x06,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0xF8,
    0xF8,0x00,0x00,0x00,0x00,0xF8,0xF8,0x00,0x00,0x00,
};

/*--  LindeDaxOffice18; font wide x height = 9x8   --*/
/*--  pixel wide x height = 9x8  --*/
font_t char_upperer_Size7[26][9] = 
{
    {0x00,0x02,0x0C,0x38,0x48,0x38,0x0C,0x02,0x00,},            //A
    {0x00,0x00,0x7E,0x52,0x52,0x52,0x2C,0x00,0x00,},            //B         
    {0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x00,0x00,},            //C
    {0x00,0x00,0x7E,0x42,0x42,0x42,0x3C,0x00,0x00,},            //D
    {0x00,0x00,0x7E,0x52,0x52,0x52,0x52,0x00,0x00,},            //E
    {0x00,0x00,0x7E,0x50,0x50,0x50,0x50,0x00,0x00,},            //F
    {0x00,0x00,0x3C,0x42,0x42,0x4A,0x0C,0x00,0x00,},            //G
    {0x00,0x00,0x7E,0x10,0x10,0x10,0x7E,0x00,0x00,},            //H
    {0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,},            //I
    {0x00,0x00,0x04,0x02,0x02,0x7C,0x00,0x00,0x00,},            //J
    {0x00,0x00,0x7E,0x18,0x24,0x42,0x00,0x00,0x00,},            //K
    {0x00,0x00,0x7E,0x02,0x02,0x02,0x00,0x00,0x00,},            //L
    {0x00,0x7E,0x20,0x18,0x06,0x18,0x20,0x7E,0x00,},            //M
    {0x00,0x00,0x7E,0x20,0x18,0x04,0x7E,0x00,0x00,},            //N
    {0x00,0x00,0x3C,0x42,0x42,0x42,0x3C,0x00,0x00,},            //O
    {0x00,0x00,0x7E,0x48,0x48,0x48,0x30,0x00,0x00,},            //P
    {0x00,0x00,0x3C,0x42,0x46,0x42,0x3D,0x00,0x00,},            //Q
    {0x00,0x00,0x7E,0x48,0x48,0x4C,0x32,0x00,0x00,},            //R
    {0x00,0x00,0x24,0x52,0x52,0x4A,0x24,0x00,0x00,},            //S
    {0x00,0x00,0x40,0x40,0x7E,0x40,0x40,0x00,0x00,},            //T
    {0x00,0x00,0x7C,0x02,0x02,0x02,0x7C,0x00,0x00,},            //U
    {0x00,0x40,0x30,0x0C,0x02,0x0C,0x30,0x40,0x00,},            //V
    {0x00,0x78,0x06,0x38,0x40,0x38,0x06,0x78,0x00,},            //W
    {0x00,0x00,0x42,0x24,0x18,0x24,0x42,0x00,0x00,},            //X
    {0x00,0x40,0x20,0x10,0x0E,0x10,0x20,0x40,0x00,},            //Y
    {0x00,0x42,0x46,0x4A,0x52,0x62,0x42,0x00,0x00,},            //Z
};





void lcd_draw_upperchar( s16 start_row, s16 start_column, font_size size, char character, u8 is_hide)
{
    unsigned char j;
    if(size == SIZE_7)  //SIZE_7, It's vertial page is 0
    {
        for(j = 0; j < 9; j++)
        {
            if(is_hide == HIDE_ENABLE)
            {
                OLED_GRAM[start_row][j + start_column] = 0x00;
            }
            else
            {
                OLED_GRAM[start_row][j + start_column] = char_upperer_Size7[character - 65][j];
            }           
        }       
    }   
}

/*void lcd_draw_number( S16 start_row, S16 start_column, font_size size, int number, U8 is_hide)*/
/*Draw number charcter on the LCD*/
/*S16 start_row : the charcter's left and top point y-location page from 0 ~ 7*/
/*S16 start_column : the charcter's left and top point x-location pixel from 0 ~ 127*/
/*font_size size : the number's size which is a emnu, SIZE_22, SIZE_12, SIZE_7*/
/*int number : the number charcter you want to display from 0 ~ 9*/
/*U8 is_hide : set HIDE_ENABLE to hide the character and it will leave a blank white, set HIDE_DISABLE the show the character, and it will display on the LCD*/
void lcd_draw_number( s16 start_row, s16 start_column, font_size size, int number, u8 is_hide)
{
    unsigned char i, j;
    if(size == SIZE_22)         //SIZE_22, It's vertial page from 0~3
    {
        for(i = 0; i < 4; i ++)
        {
            for(j = 0; j < 18; j++)
            {
                if(is_hide == HIDE_ENABLE)
                {
                    OLED_GRAM[i + start_row][j + start_column] = 0x00;
                }
                else
                {
                    OLED_GRAM[i + start_row][j + start_column] = number_Size22[number][i * 18 + j];
                }           
            }
        }
    }
    else if(size == SIZE_12)    //SIZE_12, It's vertial page from 0~2
    {
        for(i = 0; i < 2; i ++)
        {
            for(j = 0; j < 13; j++)
            {
                if(is_hide == HIDE_ENABLE)
                {
                    OLED_GRAM[i + start_row][j + start_column] = 0x00;
                }
                else
                {
                    OLED_GRAM[i + start_row][j + start_column] = number_Size12[number][i * 13 + j];
                }           
            }
        }       
    }
    else if(size == SIZE_7) //SIZE_7, It's vertial page is 0
    {
        for(j = 0; j < 7; j++)
        {
            if(is_hide == HIDE_ENABLE)
            {
                OLED_GRAM[start_row][j + start_column] = 0x00;
            }
            else
            {
                OLED_GRAM[start_row][j + start_column] = number_Size7[number][j];
            }           
        }       
    }
}


void lcd_draw_sign( s16 start_row, s16 start_column, font_size size, int sign)
{
    unsigned char i, j;
    if(size == SIZE_22)
    {
        for(i = 0; i < 4; i ++)
        {
            for(j = 0; j < 26; j++)
            {
                OLED_GRAM[i + start_row][j + start_column] = sign_size22[sign][i * 26 + j];
            }
        }
    }
    else if(size == SIZE_12)
    {
        for(i = 0; i < 2; i ++)
        {
            for(j = 0; j < 13; j++)
            {
                OLED_GRAM[i + start_row][j + start_column] = sign_size12[sign][i * 13 + j];
            }
        }
    }
    else if(size == SIZE_7)
    {
        for(j = 0; j < 9; j++)
        {
            OLED_GRAM[start_row][j + start_column] = sign_size7[sign][j];
        }
    }
}



/**
* @brief    Display_H24_Str 
* @param    none
* @note     none
* @retval   none
*/
u16 Display_H24_Str(u8 *str,s16 row,s16 column, u8 invert)
{ 
    char character;
    char number;

    if(invert == HIDE_DISABLE)
    {
        do
        {
            character = *str;
            if((character >= 65) && (character <= 90))
            {
                lcd_draw_upperchar(row, column, SIZE_7, character, 0);
                
            }
            else if((character >= 48) && (character <= 57))
            {
                number = character - 48;
                lcd_draw_number(row, column - 2, SIZE_7, number, 0);
            }
            else
            {
                switch (character)
                {
                    case '%': lcd_draw_sign( row, column, SIZE_7, 0); break;    //Display '%'
                    case '/': lcd_draw_sign( row, column, SIZE_7, 1); break;    //Display '/'
                    case ':': lcd_draw_sign( row, column, SIZE_7, 2); break;    //Display ':'
                    case '!': lcd_draw_sign( row, column, SIZE_7, 3); break;    //Display '!'
                    case '+': lcd_draw_sign( row, column, SIZE_7, 4); break;    //Display '+'
                    case '-': lcd_draw_sign( row, column, SIZE_7, 5); break;    //Display '-'
                    case ';': lcd_draw_sign( row, column, SIZE_7, 6); break;    //Display ';'
                    case '.': lcd_draw_sign( row, column, SIZE_7, 7); break;    //Display '.'
                    case ' ': lcd_draw_sign( row, column, SIZE_7, 8); break;    //Display ' '
                    case '*': lcd_draw_sign( row, column, SIZE_7, 9); break;    //Display ' '
                    default: break;
                }
            }           
            // To adjust the distence between to near characters
            if((character == 'M') ||(character == 'W') || (character == '%')|| (character == 'A')||(character == '*')||(character == '-'))
            {
                column += 8;
            }
            else if(character == ' ')
            {
                column += 6;
            }
            else
            {
                column += 7;
            }
            str ++;
        }while(character != '\0');
    }
    
    lcd_refresh();
    return 0;

}


void LCD_clear(void)
{
    memset(OLED_GRAM, 0, 1024);
    lcd_refresh();
}



